﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Cloud.Core.Data;
using Cloud.Entity;
using Microsoft.EntityFrameworkCore.Storage;

namespace Cloud.UnitOfWork
{
    public interface IUnitOfWork : IDisposable
    {
        //IRepository<Sys_Error_Log> SysErrorLogRep { get; }
        //IRepository<Sys_Module> SysModuleRep { get; }
        //IRepository<Sys_Operation_Log> SysOperationLogRep { get; }
        //IRepository<Sys_Permission> SysPermissionRep { get; }
        //IRepository<Sys_Role> SysRoleRep { get; }
        //IRepository<Sys_Role_User> SysRoleUserRep { get; }
        //IRepository<Sys_User> SysUserRep { get; }

        IDbContextTransaction BeginTransaction();

        int SaveChanges();
        Task<int> SaveChangesAsync();
        List<T> SqlQuery<T>(string sql, object param = null) where T : class;
        Task<List<T>> SqlQueryAsync<T>(string sql, object param = null) where T : class;
        IRepository<T> GetRepository<T>() where T : BaseEntity;
        IQueryable<TEntity> FromSql<TEntity>(string sql, params object[] parameters) where TEntity : BaseEntity;
    }
}